﻿@mixin svg-icon() {
  content: "";
  background-repeat: no-repeat;
  background-position: center;
}

:root {
  --sjs-default-font-family: "Segoe UI", "Helvetica Neue", Helvetica, Arial, sans-serif;
}

$font-family: var(--font-family, var(--sjs-default-font-family));

@import "./common-styles/sv-progress-buttons.scss";
@import "./common-styles/sv-navigation-toc.scss";
@import "./common-styles/window.scss";
@import "./common-styles/sv-brand-info.scss";
@import "./common-styles/sv-drag-drop.scss";
@import "./common-styles/sv-save-data.scss";
@import "./common-styles/sv-ranking.scss";

$header-background-color: #e7e7e7;
$body-container-background-color: #f4f4f4;

$main-color: #1ab394;
$main-hover-color: darken($main-color, 5%);
$body-background-color: white;
$inputs-background-color: $body-background-color;
$text-color: #6d7072;
$header-color: $text-color;
$border-color: $header-background-color;

$error-color: #ed5565;
$error-background-color: lighten($error-color, 30%);

$header-height: 74%;
$font-size: 14px;

$base-line-height: 2em;

$slider-color: $body-background-color;
$label-disabled-color: rgba(64, 64, 64, 0.5);

$progress-buttons-line-color: #d4d4d4;
$text-input-color: #6d7072;
$disabled-switch-color: #9f9f9f;
$background-dim: #f3f3f3;
$foreground-disabled: #161616;

body {
  --sv-default-mark: true;
}

.sv_main.sv_frame {
  .sv_container {
    max-width: 80%;
    margin: auto;
    padding: 0 1em;

    .sv_header {
      padding-top: 5em;
      padding-bottom: 1em;
    }
  }
}

.sv_main {
  --sv-mobile-width: 600px;
  background-color: var(--body-container-background-color, $body-container-background-color);

  hr {
    border-bottom: 1px solid var(--border-color, $border-color);
  }

  input[type="button"],
  button {
    color: var(--body-background-color, $body-background-color);
    background-color: var(--main-color, $main-color);

    &:hover {
      background-color: var(--main-hover-color, $main-hover-color);
    }
  }

  .sv_q_other input,
  .sv_q_text_root,
  .sv_q_dropdown_control,
  input:not([type="button"]):not([type="reset"]):not([type="submit"]):not([type="image"]):not([type="checkbox"]):not([type="radio"]),
  select,
  textarea {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    border: 1px solid var(--border-color, $border-color);
    color: var(--text-color, $text-color);
    background-color: var(--inputs-background-color, $inputs-background-color);
    opacity: 1;

    &:focus {
      border: 1px solid var(--main-color, $main-color);
    }
  }

  .sv_q_dropdown_control {
    display: flex;
    justify-content: space-between;
    padding-inline-end: 1em; //padding-right: 1em;
  }

  .sv_q_dropdown__value {
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    width: 100%;
    position: relative;
  }

  .sv_q_dropdown__hint-prefix {
    span {
      word-break: unset;
    }

    opacity: 0.5;
  }

  .sv_q_dropdown__hint-suffix {
    display: flex;

    span {
      word-break: unset;
    }

    opacity: 0.5;
  }

  .sv_q_dropdown_control__input-field-component {
    height: auto;
  }

  .sv_q_dropdown_clean-button {
    margin: auto 2em;
  }

  .sv_q_dropdown_clean-button-svg {
    width: 1em;
    height: 1em;
  }

  .sv_q_dropdown__filter-string-input {
    position: absolute;
    inset-inline-start: 0; //left: 0;
    top: 0;
    height: 100%;
    width: 100%;
    max-width: 100%;
    border: none;
    outline: none;
    padding: 0px;
    width: auto;
    display: flex;
    flex-grow: 1;
    overflow: hidden;
    text-overflow: ellipsis;
    white-space: nowrap;
    display: inline-block;
    background-color: transparent;
  }

  .sv_q_tagbox__filter-string-input {
    position: initial;
  }

  .sv_q_tagbox__placeholder {
    position: absolute;
    top: 0;
    left: 1em;
    max-width: 100%;
    width: auto;
    height: 100%;
    text-align: left;
    cursor: text;
    pointer-events: none;
  }

  .sv_q_input.sv_q_input.sv_q_input.sv_q_tagbox.sv_q_tagbox.sv_q_tagbox {
    height: auto;
  }

  .sv_q_tagbox__value.sv_q_dropdown__value {
    display: flex;
    flex-wrap: wrap;
    padding-inline: unset;
    margin-inline: unset;
    margin-block: unset;
    gap: 4px;
  }

  .sv-tagbox__item {
    position: relative;
    display: flex;
    border-radius: 2px;
    color: var(--body-background-color, $body-background-color);
    background-color: var(--main-color, $main-color);
  }

  .sv_q_tagbox-item_clean-button-svg {
    fill: var(--body-background-color, $body-background-color);
    width: 16px;
    height: 16px;
  }

  .sv_select_wrapper {
    background-color: var(--body-background-color, $body-background-color);

    &:before {
      background-color: var(--main-color, $main-color);
    }
  }

  .sv_header {
    color: var(--header-color, $header-color);
  }

  .sv_custom_header {
    background-color: var(--header-background-color, $header-background-color);
  }

  .sv_container {
    color: var(--text-color, $text-color);
  }

  .sv_body {
    background-color: var(--body-background-color, $body-background-color);
    border-top: 2px solid var(--main-color, $main-color);
  }

  .sv_progress {
    background-color: var(--border-color, $border-color);
    margin-bottom: 2em;
  }

  .sv_progress_bar {
    background-color: var(--main-color, $main-color);
  }

  .sv_p_root {
    &>.sv_row {
      border-bottom: 1px solid var(--border-color, $border-color);

      &:nth-child(odd) {
        background-color: var(--body-background-color, $body-background-color);
      }

      &:nth-child(even) {
        background-color: var(--body-container-background-color, $body-container-background-color);
      }
    }
  }

  .sv_q_erbox:not([style*="display: none"]):not([style*="display:none"]) {
    border: 1px solid var(--error-color, $error-color);
    background-color: var(--error-background-color, $error-background-color);
    color: var(--error-color, $error-color);

    &+input,
    &+textarea,
    &+.sv_select_wrapper select {
      border: 1px solid var(--error-color, $error-color);

      &:focus {
        outline: var(--error-color, $error-color) auto 5px;
      }
    }
  }

  table.sv_q_matrix,
  table.sv_q_matrix_dropdown,
  table.sv_q_matrix_dynamic {
    tr {
      border-bottom: 1px solid var(--border-color, $border-color);
    }
  }

  .sv_matrix_cell {
    vertical-align: top;
  }

  .sv_matrix_cell_detail {
    vertical-align: middle;
    text-align: center;
    width: 32px;
  }

  .sv-table__cell--choice {
    text-align: center;
  }

  .sv_matrix_cell_detail_button {
    width: 29px;
    height: 29px;
    min-width: 0px;
    padding: 0;
    outline: none;
  }

  .sv_matrix_cell_detail_button_expanded {
    background-color: lightgray;

    &:hover {
      background-color: darkgray;
    }
  }

  .sv_matrix_cell_detail_rowtext {
    vertical-align: middle;
  }

  .sv_q_m_cell_selected {
    color: var(--body-background-color, $body-background-color);
    background-color: var(--main-hover-color, $main-hover-color);
  }

  .sv_q_rating_item {
    &.active {
      .sv_q_rating_item_text {
        background-color: var(--main-hover-color, $main-hover-color);
        border-color: var(--main-hover-color, $main-hover-color);
        color: var(--body-background-color, $body-background-color);
      }
    }

    .sv_q_rating_item_text {
      border: 1px solid var(--border-color, $border-color);

      &:hover {
        border: 1px solid var(--main-hover-color, $main-hover-color);
      }
    }
  }

  .sv_q_rating__item-star>svg {
    &.sv-star-2 {
      display: none;
    }

    height: 32px;
    width: 32px;
    display: inline-block;
    vertical-align: middle;
    border: 1px solid transparent;

    &:hover {
      border: 1px solid var(--main-hover-color, $main-hover-color);
    }

    fill: var(--text-color, $text-color);
  }

  .sv_q_rating__item-star--selected>svg {
    fill: var(--main-color, $main-color);
  }

  .sv_q_rating__item-smiley>svg {
    height: 24px;
    width: 24px;
    padding: 4px;
    display: inline-block;
    vertical-align: middle;
    border: 1px solid var(--border-color, $border-color);

    &>use {
      display: block;
    }

    &:hover {
      border: 1px solid var(--main-hover-color, $main-hover-color);
    }

    fill: var(--text-color, $text-color);
  }

  .sv_q_rating__item-smiley--selected>svg {
    background-color: var(--main-hover-color, $main-hover-color);
    fill: var(--body-background-color, $body-background-color);
  }

  .sv_q_imgsel.checked label>div {
    background-color: var(--main-color, $main-color);
  }

  .sv_q_file_remove:hover {
    color: var(--main-color, $main-color);
  }

  .sv-boolean__switch {
    background-color: var(--main-color, $main-color);
    outline-color: var(--main-color, $main-color);
  }

  .sv-boolean__slider {
    background-color: var(--slider-color, $slider-color);
  }

  .sv-boolean__label--disabled {
    color: var(--label-disabled-color, $label-disabled-color);
  }
}

.sv_main {
  // position: relative;
  width: 100%;
  //background-color: var(--body-container-background-color, $body-container-background-color);
  font-family: $font-family;
  font-size: var(--font-size, $font-size);

  hr {
    border: none;
    //border-bottom: 1px solid var(--header-background-color, $header-background-color);
  }

  input[type="button"],
  button {
    appearance: none;
    -webkit-appearance: none;
    -moz-appearance: none;
    font-size: 0.85em;
    font-weight: bold;
    //color: var(--body-background-color, $body-background-color);
    line-height: var(--base-line-height, $base-line-height);
    //background-color: var(--main-color, $main-color);
    border: none;
    min-width: 100px;
    cursor: pointer;
    padding: 0.3em 2em;
    border-radius: 2px;

    &:hover {
      //background-color: var(--main-hover-color, $main-hover-color);
    }
  }

  .sv_custom_header {
    // position: absolute;
    width: 100%;
    height: var(--header-height, $header-height);
    max-height: 275px;
    //background-color: var(--header-background-color, $header-background-color);
  }

  .sv_container {
    position: relative;
    //color: var(--text-color, $text-color);
  }

  .sv_header {
    padding: 1em;

    h3 {
      font-size: 2em;
      font-weight: 300;
      margin: 0;
    }
  }

  .sv_body.sv_completed_page {
    text-align: center;
    padding: 5em 1em;

    >h3 {
      margin: 0;
      font-size: 30px;
      font-weight: 300;
    }
  }

  .sv_body {
    //background-color: var(--body-background-color, $body-background-color);
    padding: 1em 1em 1.6428em 1em;
    //border-top: 2px solid var(--main-color, $main-color);
  }

  .sv_progress {
    height: 0.3em;
    //background-color: var(--header-background-color, $header-background-color);

    .sv_progress_bar {
      height: 100%;
      min-width: 100px;
      //background-color: var(--main-color, $main-color);
      position: relative;
      margin-top: 2em;

      >span {
        position: absolute;
        top: -1.5em;
        display: inline-block;
        white-space: nowrap;
      }
    }
  }

  .sv_p_root {
    .sv_page_title {
      font-size: 1em;
      margin-top: 0.1em;
      font-weight: normal;
    }

    .sv_p_title {
      font-weight: bold;
      font-size: 1.15em;
      margin: 1.5em 0 0 0;
    }

    .sv_p_panel {
      margin: 0 0 1.5em 0;
    }

    &>.sv_row {
      //border-bottom: 1px solid var(--header-background-color, $header-background-color);
      padding: 0;

      &:nth-child(odd) {
        //background-color: var(--body-background-color, $body-background-color);
      }

      &:nth-child(even) {
        //background-color: var(--body-container-background-color, $body-container-background-color);
      }
    }

    .sv_q_title {
      font-weight: bold;
      font-size: 1em;
      margin: 0.5em 0;
    }

    .sv_q--disabled .sv_q_title {
      color: var(--label-disabled-color, $label-disabled-color);
    }

    .sv_q--disabled .sv_q_file .sv_q_file_choose_button {
      display: none;
    }

    .sv_q_description {
      margin-top: -0.6em;
      min-height: 0.6em;
    }

    .sv_q_flow {

      .sv_q_checkbox_inline,
      .sv_q_radiogroup_inline,
      .sv_q_imagepicker_inline {
        line-height: var(--base-line-height, $base-line-height);
        display: inline-block;
      }
    }

    .sv_q {
      padding: 0.5em var(--sv-element-add-padding-right, 1em) 1.5em var(--sv-element-add-padding-left, 1em);
      box-sizing: border-box;
      overflow: auto;

      .sv_panel_dynamic {
        .sv_q_title {
          font-weight: normal;
        }

        .sv-paneldynamic__progress-container {
          position: relative;
          display: inline-block;
          width: calc(100% - 250px);
          margin-left: 40px;
          margin-top: 10px;
        }
      }

      .sv_q_erbox:not([style*="display: none"]):not([style*="display:none"]) {
        //border: 1px solid var(--error-color, $error-color);
        //background-color: var(--error-background-color, $error-background-color);
        margin: 1em 0;
        //color: var(--error-color, $error-color);
        padding: 1em;

        &+input,
        &+textarea,
        &+.sv_select_wrapper select {

          //border: 1px solid var(--error-color, $error-color);
          &:focus {
            //outline: var(--error-color auto 5px, $error-color auto 5px);
          }
        }
      }

      .sv_q_other input,
      .sv_q_text_root,
      .sv_q_dropdown_control,
      input:not([type="button"]):not([type="reset"]):not([type="submit"]):not([type="image"]):not([type="checkbox"]):not([type="radio"]),
      select,
      textarea {
        position: relative;
        width: 100%;
        box-sizing: border-box;
        //border: 1px solid var(--header-background-color, $header-background-color);
        font-size: 1em;
        line-height: var(--base-line-height, $base-line-height);
        //color: var(--text-color, $text-color);
        padding-inline-start: 1em; //padding-left: 1em;
        //background-color: var(--inputs-background-color, $inputs-background-color);

        &:focus {
          //border-color: var(--main-color, $main-color);
          outline: none;
          //border: 1px solid var(--main-color, $main-color);
        }
      }

      .sv_q_other input,
      .sv_q_dropdown_control,
      input:not([type="button"]):not([type="reset"]):not([type="submit"]):not([type="image"]):not([type="checkbox"]):not([type="radio"]),
      select {
        height: calc(#{$base-line-height} + 1px);
      }

      .sv_q_dropdown_control__input-field-component {
        height: auto;
      }

      div.sv_q_text_root,
      div.sv_q_dropdown_control {
        min-height: 2em;
        min-width: 7em;
      }

      .sv_select_wrapper {
        width: 100%;
        position: relative;
        display: inline-block;
        //background-color: var(--body-background-color, $body-background-color);

        select {
          display: block;
          background: transparent;
          appearance: none;
          -webkit-appearance: none;
          -moz-appearance: none;
          padding-right: 2.5em;

          &::-ms-expand {
            display: none;
          }
        }

        &:before {
          padding: 1em;
          position: absolute;
          inset-inline-end: 0; //right
          top: 1px;
          //background-color: var(--main-color, $main-color);
          background-image: url("");
          @include svg-icon();
          //height: 2em;
          z-index: 1;
          pointer-events: none;
        }
      }

      .sv_select_wrapper.sv_q_tagbox_wrapper::before {
        height: 100%;
        padding: 0 1em;
      }

      input[type="color"] {
        min-height: var(--base-line-height, $base-line-height);
        padding: 0;
      }

      input[type="radio"],
      input[type="checkbox"] {
        margin: 0;
        margin-right: 0.55em;
        width: 1.2em;
        height: 1.2em;
        vertical-align: middle;
        font-size: 1em;
        margin-top: -0.1em;

        &:focus {
          outline: 1px dotted var(--main-color, $main-color);
        }
      }

      .sv_q_radiogroup.sv_q_radiogroup_inline:not(:last-child),
      .sv_q_checkbox.sv_q_checkbox_inline:not(:last-child),
      .sv_q_imgsel.sv_q_imagepicker_inline:not(:last-child) {
        margin-right: 1.5em;
      }

      .sv_q_imgsel label>div {
        overflow: hidden;
        white-space: nowrap;
        text-overflow: ellipsis;
        padding: 4px;
        border: 1px solid lightgray;
        border-radius: 4px;

        >img {
          display: block;
          pointer-events: none;
          position: relative;
        }
      }

      // .sv_q_radiogroup,
      // .sv_q_checkbox {
      //   var(--total-columns: 5, $total-columns: 5);
      //   @for $i from 1 through $total-columns {
      //     &.sv-q-col-#{$i} {
      //       width: 100% / var(--i, $i);
      //       display: inline-block;
      //       @media only screen and (max-width: 480px) {
      //         width: 100%;
      //       }
      //     }
      //   }
      // }

      .sv_q_radiogroup_clear {
        margin-top: 0.5em;
      }

      .sv_q_checkbox_inline,
      .sv_q_radiogroup_inline,
      .sv_q_imagepicker_inline {
        line-height: var(--base-line-height, $base-line-height);
        display: inline-block;
      }

      .sv_q_footer {
        padding: 1em 0;
      }
    }

    table {
      width: 100%;
      border-collapse: collapse;

      &.sv_q_matrix,
      &.sv_q_matrix_dropdown,
      &.sv_q_matrix_dynamic {
        .sv_matrix_dynamic_button {
          padding: 0.3em 2em;
        }

        tr {
          //border-bottom: 1px solid var(--header-background-color, $header-background-color);
        }
      }

      &.sv_q_matrix {

        td,
        th {
          padding: 0.5em 1em;
          text-align: center;
        }

        td {
          @media (min-width: 768px) {
            min-width: 10em;
          }

          .sv_q_m_label {
            position: static;
            display: block;
            width: 100%;
          }

          &:first-child {
            text-align: left;
          }
        }
      }

      &.sv_q_matrix_dropdown {
        .sv_qcbc {
          .sv_q_checkbox_control_label {
            margin-right: 1.5em;
          }
        }
      }

      td,
      th {
        padding: 0 1em;
      }

      td {
        padding: 0.5em;
      }

      th {
        line-height: 1.3em;
        padding: 0.5em;
        vertical-align: bottom;
        font-weight: bold;
      }
    }

    fieldset.sv_qcbc {
      line-height: var(--base-line-height, $base-line-height);
      padding-top: 0.1em;
    }

    .sv_q_checkbox_label,
    .sv_q_radiogroup_label {
      display: block;
    }

    .sv_q_other {
      margin-left: 1em;
    }

    .sv_q_select_column {
      display: inline-block;
      vertical-align: top;
      min-width: 10%;
    }

    .sv_q_rating {
      line-height: var(--base-line-height, $base-line-height);

      .sv_q_rating_item {
        cursor: pointer;
        word-spacing: -0.3em;
        font-weight: normal;
        display: inline;

        >* {
          word-spacing: initial;

          @media all and (-ms-high-contrast: none),
          (-ms-high-contrast: active) {
            word-spacing: normal;
          }
        }

        &.active {
          .sv_q_rating_item_text {
            //background-color: var(--main-hover-color, $main-hover-color);
            //border-color: var(--main-hover-color, $main-hover-color);
            //color: var(--body-background-color, $body-background-color);
          }
        }

        .sv_q_rating_item_text {
          display: inline-block;
          min-width: var(--base-line-height, $base-line-height);
          padding: 0 0.3em;
          margin-left: -1px;
          //border: 1px solid var(--header-background-color, $header-background-color);
          text-align: center;

          &:hover {
            //border: 1px solid var(--main-color, $main-color);
          }
        }

        &:not(:nth-child(2)) {
          .sv_q_rating_item_text:not(:hover) {
            border-left-color: transparent;
          }
        }
      }

      .sv_q_rating_min_text {
        margin-right: 0.5em;
      }

      .sv_q_rating_max_text {
        margin-left: 0.5em;
      }
    }
  }

  .sv_nav {
    display: block;
    padding-top: 1em;
    min-height: var(--base-line-height, $base-line-height);

    .sv_nav_btn {
      float: right;
      margin: 0 16px;
    }

    .sv-action {
      display: block;
    }

    .sv-action:not(:last-child) {
      .sv-action__content {
        padding: 0;
      }
    }

    .sv-action__content {
      display: block;
    }

    .sv_start_btn,
    .sv_next_btn,
    .sv_complete_btn {
      float: right;
    }

    .sv_preview_btn {
      float: right;
    }

    .sv_prev_btn {
      float: left;
    }
  }

  .sv_q_image {
    display: inline-block;
  }
}

.sv_main.sv_main .sv-action-bar-item.sv_edit_btn {
  color: var(--body-background-color, $body-background-color);
  background-color: var(--main-color, $main-color);
  float: left;
  margin-bottom: 7px;
}

.sv_main.sv_main .sv-action-bar-item.sv_edit_btn:hover {
  background-color: var(--main-hover-color, $main-hover-color);
}

// https://github.com/surveyjs/survey-library/issues/2559
.sv_main .sv_p_root .sv_row {
  .sv_q.sv_qstn {
    &:first-child:last-child {
      flex: none !important;
    }
  }
}

.sv_q_dropdown_control input[readonly] {
  pointer-events: none;
}

@import "./main.rtl.scss";
@import "./main.m600.scss";

.sv_main {
  .sv_qstn .sv_q_file {
    .sv-visuallyhidden {
      position: absolute !important;
      opacity: 0;
    }

    .sv_q_file_choose_button {
      display: inline-block;
      box-sizing: border-box;
      min-width: 100px;
      line-height: 2em;
      padding: 0.25em 2em;
      font-size: 0.85em;
      font-weight: bold;
      border: none;
      border-radius: 2px;
      cursor: pointer;
    }

    .sv_q_file_remove_button {
      padding: 0.25em 2em;
    }

    .sv-file__decorator {
      display: inline-block;
      min-width: 250px;

      .sv_q_file_placeholder {
        margin-left: 1em;
        display: inline-block;
      }
    }
  }
}

.sv-visuallyhidden {
  position: absolute;
  width: 1px;
  height: 1px;
  overflow: hidden;
  clip: rect(0 0 0 0);
}

@import "./signaturepad.scss";
@import "./boolean-checkbox.scss";
@import "./components-container.scss";

.sv-dragdrop-movedown {
  transform: translate(0, 0);
  animation: svdragdropmovedown 0.1s;
  animation-timing-function: ease-in-out;
}

@keyframes svdragdropmovedown {
  0% {
    transform: translate(0, -50px);
  }

  100% {
    transform: translate(0, 0);
  }
}

.sv-dragdrop-moveup {
  transform: translate(0, 0);
  animation: svdragdropmoveup 0.1s;
  animation-timing-function: ease-in-out;
}

@keyframes svdragdropmoveup {
  0% {
    transform: translate(0, 50px);
  }

  100% {
    transform: translate(0, 0);
  }
}

@import "./main-default-theme.scss";
@import "./default-styles.scss";